module dgl.input.MouseMessageHooker;

import dgl.input.Mouse;
import derelict.sdl.sdl;

package static class MouseMessageHooker
{
	public static void processEvent( SDL_Event event )
	{
		switch( event.type )
		{
		case SDL_MOUSEMOTION:
			Mouse.onMouseMove();
			break;
		case SDL_MOUSEBUTTONDOWN:
			switch( event.button.button )
			{
			case SDL_BUTTON_LEFT:
				Mouse.onLeftButtonDown();
				break;
			case SDL_BUTTON_MIDDLE:
				Mouse.onMiddleButtonDown();
				break;
			case SDL_BUTTON_RIGHT:
				Mouse.onRightButtonDown();
				break;
			default:
				break;
			}
			break;
		case SDL_MOUSEBUTTONUP:
			switch( event.button.button )
			{
			case SDL_BUTTON_LEFT:
				Mouse.onLeftButtonUp();
				break;
			case SDL_BUTTON_MIDDLE:
				Mouse.onMiddleButtonUp();
				break;
			case SDL_BUTTON_RIGHT:
				Mouse.onRightButtonUp();
				break;
			default:
				break;
			}
		default:
			break;
		}
	}
}